<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 1. Zend_Gdata</title>
<link rel="stylesheet" href="dbstyle.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
<link rel="start" href="index.html" title="Programmer's Reference Guide">
<link rel="up" href="index.html" title="Programmer's Reference Guide">
<link rel="prev" href="index.html" title="Programmer's Reference Guide">
<link rel="next" href="zend.gdata.authsub.html" title="1.2. Authenticating with AuthSub">
<link rel="chapter" href="zend.gdata.html" title="Chapter 1. Zend_Gdata">
<link rel="appendix" href="migration.html" title="Appendix A. ">
<link rel="appendix" href="performance.html" title="Appendix B. ">
<link rel="index" href="the.index.html" title="Index">
<link rel="section" href="zend.gdata.html#zend.gdata.introduction" title="1.1. Introduction">
<link rel="section" href="zend.gdata.authsub.html" title="1.2. Authenticating with AuthSub">
<link rel="section" href="zend.gdata.clientlogin.html" title="1.3. Authenticating with ClientLogin">
<link rel="section" href="zend.gdata.calendar.html" title="1.4. Using Google Calendar">
<link rel="section" href="zend.gdata.docs.html" title="1.5. Using Google Documents List Data API">
<link rel="section" href="zend.gdata.spreadsheets.html" title="1.6. Using Google Spreadsheets">
<link rel="section" href="zend.gdata.gapps.html" title="1.7. Using Google Apps Provisioning">
<link rel="section" href="zend.gdata.gbase.html" title="1.8. Using Google Base">
<link rel="section" href="zend.gdata.photos.html" title="1.9. Using Picasa Web Albums">
<link rel="section" href="zend.gdata.youtube.html" title="1.10. Using the YouTube Data API">
<link rel="section" href="zend.gdata.exception.html" title="1.11. Catching Gdata Exceptions">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader"><table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Chapter 1. Zend_Gdata</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="index.html">Prev</a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="zend.gdata.authsub.html">Next</a>
</td>
</tr>
</table></div>
<div class="chapter" lang="en">
<div class="titlepage"><div><div><h2 class="title">
<a name="zend.gdata"></a>Chapter 1. Zend_Gdata</h2></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
<dt><span class="sect1"><a href="zend.gdata.html#zend.gdata.introduction">1.1. Introduction</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.structure">1.1.1. Structure of Zend_Gdata</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.services">1.1.2. Interacting with Google Services</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.magicfactory">1.1.3. Obtaining instances of Zend_Gdata classes</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.authentication">1.1.4. Google Data Client Authentication</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.dependencies">1.1.5. Dependencies</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.creation">1.1.6. Creating a new Gdata client</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.parameters">1.1.7. Common Query Parameters</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.getfeed">1.1.8. Fetching a Feed</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.paging">1.1.9. Working with Multi-page Feeds</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.usefeedentry">1.1.10. Working with Data in Feeds and Entries</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.updateentry">1.1.11. Updating Entries</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.post">1.1.12. Posting Entries to Google Servers</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.html#zend.gdata.introduction.delete">1.1.13. Deleting Entries on Google Servers</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.authsub.html">1.2. Authenticating with AuthSub</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.authsub.html#zend.gdata.authsub.login">1.2.1. Creating an AuthSub authenticated Http Client</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.authsub.html#zend.gdata.authsub.logout">1.2.2. Revoking AuthSub authentication</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.clientlogin.html">1.3. Authenticating with ClientLogin</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.clientlogin.html#zend.gdata.clientlogin.login">1.3.1. Creating a ClientLogin authenticated Http Client</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.clientlogin.html#zend.gdata.clientlogin.terminating">1.3.2. Terminating a ClientLogin authenticated Http Client</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.calendar.html">1.4. Using Google Calendar</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.calendar.html#zend.gdata.calendar.connecting">1.4.1. Connecting To The Calendar Service</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.calendar.connecting.authentication">1.4.1.1. Authentication</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.calendar.connecting.service">1.4.1.2. Creating A Service Instance</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.calendar.html#zend.gdata.calendar_retrieval">1.4.2. Retrieving A Calendar List</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.calendar.html#zend.gdata.event_retrieval">1.4.3. Retrieving Events</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.event_retrieval.queries">1.4.3.1. Queries</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.event_retrieval.start_time">1.4.3.2. Retrieving Events In Order Of Start Time</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.event_retrieval.date_range">1.4.3.3. Retrieving Events In A Specified Date Range</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.event_retrieval.fulltext">1.4.3.4. Retrieving Events By Fulltext Query</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.event_retrieval.individual">1.4.3.5. Retrieving Individual Events</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.calendar.html#zend.gdata.calendar.creating_events">1.4.4. Creating Events</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.calendar.creating_events.single">1.4.4.1. Creating Single-Occurrence Events</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.calendar.creating_events.schedulers_reminders">1.4.4.2. Event Schedules and Reminders</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.calendar.creating_events.recurring">1.4.4.3. Creating Recurring Events</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.calendar.html#zend.gdata.calendar.creating_events.quickadd">1.4.4.4. Using QuickAdd</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.calendar.html#zend.gdata.calendar.modifying_events">1.4.5. Modifying Events</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.calendar.html#zend.gdata.calendar.deleting_events">1.4.6. Deleting Events</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.calendar.html#zend.gdata.calendar.comments">1.4.7. Accessing Event Comments</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.docs.html">1.5. Using Google Documents List Data API</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.docs.html#zend.gdata.docs.listdocuments">1.5.1. Get a List of Documents</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.docs.html#zend.gdata.docs.creating">1.5.2. Upload a Document</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.docs.html#zend.gdata.docs.queries">1.5.3. Searching the documents feed</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.docs.html#zend.gdata.docs.listwpdocuments">1.5.3.1. Get a List of Word Processing Documents</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.docs.html#zend.gdata.docs.listspreadsheets">1.5.3.2. Get a List of Spreadsheets</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.docs.html#zend.gdata.docs.textquery">1.5.3.3. Performing a text query</a></span></dt>
</dl></dd>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.spreadsheets.html">1.6. Using Google Spreadsheets</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.creating">1.6.1. Create a Spreadsheet</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.listspreadsheets">1.6.2. Get a List of Spreadsheets</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.listworksheets">1.6.3. Get a List of Worksheets</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.listfeeds">1.6.4. Interacting With List-based Feeds</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.listfeeds.get">1.6.4.1. Get a List-based Feed</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.listfeeds.reverse">1.6.4.2. Reverse-sort Rows</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.listfeeds.sq">1.6.4.3. Send a Structured Query</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.listfeeds.addrow">1.6.4.4. Add a Row</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.listfeeds.editrow">1.6.4.5. Edit a Row</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.listfeeds.deleterow">1.6.4.6. Delete a Row</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.cellfeeds">1.6.5. Interacting With Cell-based Feeds</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.cellfeeds.get">1.6.5.1. Get a Cell-based Feed</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.cellfeeds.cellrangequery">1.6.5.2. Send a Cell Range Query</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.spreadsheets.html#zend.gdata.spreadsheets.cellfeeds.updatecell">1.6.5.3. Change Contents of a Cell</a></span></dt>
</dl></dd>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.gapps.html">1.7. Using Google Apps Provisioning</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.gapps.html#zend.gdata.gapps.domain">1.7.1. Setting the current domain</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.domain.service">1.7.1.1. Setting the domain for the service class</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.domain.query">1.7.1.2. Setting the domain for query classes</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users">1.7.2. Interacting with users</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users.creating">1.7.2.1. Creating a user account</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users.retrieving">1.7.2.2. Retrieving a user account</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users.retrievingAll">1.7.2.3. Retrieving all users in a domain</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users.updating">1.7.2.4. Updating a user account</a></span></dt>
<dd><dl>
<dt><span class="sect4"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users.updating.resettingPassword">1.7.2.4.1. Resetting a user's password</a></span></dt>
<dt><span class="sect4"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users.updating.forcingPasswordChange">1.7.2.4.2. Forcing a user to change their password</a></span></dt>
<dt><span class="sect4"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users.updating.suspendingAccount">1.7.2.4.3. Suspending a user account</a></span></dt>
<dt><span class="sect4"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users.updating.grantingAdminRights">1.7.2.4.4. Granting administrative rights</a></span></dt>
</dl></dd>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.users.deleting">1.7.2.5. Deleting user accounts</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.gapps.html#zend.gdata.gapps.nicknames">1.7.3. Interacting with nicknames</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.nicknames.creating">1.7.3.1. Creating a nickname</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.nicknames.retrieving">1.7.3.2. Retrieving a nickname</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.nicknames.retrievingUser">1.7.3.3. Retrieving all nicknames for a user</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.nicknames.retrievingAll">1.7.3.4. Retrieving all nicknames in a domain</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.nicknames.deleting">1.7.3.5. Deleting a nickname</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.gapps.html#zend.gdata.gapps.emailLists">1.7.4. Interacting with email lists</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.emailLists.creating">1.7.4.1. Creating an email list</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.emailList.retrieve">1.7.4.2. Retrieving all email lists to which a recipient is
            subscribed</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.emailLists.retrievingAll">1.7.4.3. Retrieving all email lists in a domain</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.emailList.deleting">1.7.4.4. Deleting an email list</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.gapps.html#zend.gdata.gapps.emailListRecipients">1.7.5. Interacting with email list recipients</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.emailListRecipients.adding">1.7.5.1. Adding a recipient to an email list</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.emailListRecipients.retrieving">1.7.5.2. Retrieving the list of subscribers to an email list</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gapps.html#zend.gdata.gapps.emailListRecipients.removing">1.7.5.3. Removing a recipient from an email list</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.gapps.html#zend.gdata.gapps.exceptions">1.7.6. Handling errors</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.gbase.html">1.8. Using Google Base</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.gbase.html#zend.gdata.gbase.connect">1.8.1. Connect To The Base Service</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.gbase.html#zend.gdata.gbase.connect.authentication">1.8.1.1. Authentication</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gbase.html#zend.gdata.gbase.connect.service">1.8.1.2. Create A Service Instance</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.gbase.html#zend.gdata.gbase.retrieve">1.8.2. Retrieve Items</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.gbase.html#zend.gdata.gbase.retrieve.query">1.8.2.1. Send a Structured Query</a></span></dt>
<dd><dl>
<dt><span class="sect4"><a href="zend.gdata.gbase.html#zend.gdata.gbase.retrieve.query.customeritems">1.8.2.1.1. Query Customer Items Feed</a></span></dt>
<dt><span class="sect4"><a href="zend.gdata.gbase.html#zend.gdata.gbase.retrieve.query.snippets">1.8.2.1.2. Query Snippets Feed</a></span></dt>
</dl></dd>
<dt><span class="sect3"><a href="zend.gdata.gbase.html#zend.gdata.gbase.retrieve.iterate">1.8.2.2. Iterate through the Items</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.gbase.html#zend.gdata.gbase.crud">1.8.3. Insert, Update, and Delete Customer Items</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.gbase.html#zend.gdata.gbase.crud.insert">1.8.3.1. Insert an Item</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gbase.html#zend.gdata.gbase.crud.modify">1.8.3.2. Modify an Item</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.gbase.html#zend.gdata.gbase.crud.delete">1.8.3.3. Delete an Item</a></span></dt>
</dl></dd>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.photos.html">1.9. Using Picasa Web Albums</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.photos.html#zend.gdata.photos.connecting">1.9.1. Connecting To The Service</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.connecting.authentication">1.9.1.1. Authentication</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.connecting.service">1.9.1.2. Creating A Service Instance</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.photos.html#zend.gdata.photos.queries">1.9.2. Understanding and Constructing Queries</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.photos.html#zend.gdata.photos.retrieval">1.9.3. Retrieving Feeds And Entries</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.user_retrieval">1.9.3.1. Retrieving A User</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.album_retrieval">1.9.3.2. Retrieving An Album</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.photo_retrieval">1.9.3.3. Retrieving A Photo</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.comment_retrieval">1.9.3.4. Retrieving A Comment</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.tag_retrieval">1.9.3.5. Retrieving A Tag</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.photos.html#zend.gdata.photos.creation">1.9.4. Creating Entries</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.album_creation">1.9.4.1. Creating An Album</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.photo_creation">1.9.4.2. Creating A Photo</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.comment_creation">1.9.4.3. Creating A Comment</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.tag_creation">1.9.4.4. Creating A Tag</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.photos.html#zend.gdata.photos.deletion">1.9.5. Deleting Entries</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.album_deletion">1.9.5.1. Deleting An Album</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.photo_deletion">1.9.5.2. Deleting A Photo</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.comment_deletion">1.9.5.3. Deleting A Comment</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.tag_deletion">1.9.5.4. Deleting A Tag</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.photos.html#zend.gdata.photos.optimistic_concurrenty">1.9.5.5. Optimistic Concurrency (Notes On Deletion)</a></span></dt>
</dl></dd>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.youtube.html">1.10. Using the YouTube Data API</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.authentication">1.10.1. Authentication</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.developer_key">1.10.2. Developer Keys and Client ID</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.videos">1.10.3. Retrieving public video feeds</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.youtube.html#zend.gdata.youtube.videos.searching">1.10.3.1. Searching for videos by metadata</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.youtube.html#zend.gdata.youtube.videos.searchingcategories">1.10.3.2. Searching for videos by categories and tags/keywords</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.youtube.html#zend.gdata.youtube.videos.standard">1.10.3.3. Retrieving standard feeds</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.youtube.html#zend.gdata.youtube.videos.user">1.10.3.4. Retrieving videos uploaded by a user</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.youtube.html#zend.gdata.youtube.videos.favorites">1.10.3.5. Retrieving videos favorited by a user</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.youtube.html#zend.gdata.youtube.videos.responses">1.10.3.6. Retrieving video responses for a video</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.comments">1.10.4. Retrieving video comments</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.playlists">1.10.5. Retrieving playlist feeds</a></span></dt>
<dd><dl>
<dt><span class="sect3"><a href="zend.gdata.youtube.html#zend.gdata.youtube.playlists.user">1.10.5.1. Retrieving the playlists of a user</a></span></dt>
<dt><span class="sect3"><a href="zend.gdata.youtube.html#zend.gdata.youtube.playlists.special">1.10.5.2. Retrieving a specific playlist</a></span></dt>
</dl></dd>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.subscriptions">1.10.6. Retrieving a list of a user's subscriptions</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.profile">1.10.7. Retrieving a user's profile</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.uploads">1.10.8. Uploading Videos to YouTube</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.uploads.browser">1.10.9. Browser-based upload</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.uploads.status">1.10.10. Checking upload status</a></span></dt>
<dt><span class="sect2"><a href="zend.gdata.youtube.html#zend.gdata.youtube.other">1.10.11. Other Functions</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="zend.gdata.exception.html">1.11. Catching Gdata Exceptions</a></span></dt>
</dl>
</div>
<div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="zend.gdata.introduction"></a>1.1. Introduction</h2></div></div></div>
<p>
        Google Data <acronym class="acronym">API</acronym>s provide programmatic interface to some of Google's
        online services. The Google data Protocol is based upon the
        <a href="http://ietfreport.isoc.org/idref/draft-ietf-atompub-protocol/" target="_top">Atom Publishing Protocol</a>
        and allows client applications to retrieve data matching queries,
        post data, update data and delete data using standard <acronym class="acronym">HTTP</acronym> and the
        Atom syndication formation.

        The <code class="classname">Zend_Gdata</code> component is a <acronym class="acronym">PHP</acronym> 5 interface for accessing Google Data
        from <acronym class="acronym">PHP</acronym>. The <code class="classname">Zend_Gdata</code> component also supports accessing other services
        implementing the Atom Publishing Protocol.
    </p>
<p>
        See
        <a href="http://code.google.com/apis/gdata/" target="_top">http://code.google.com/apis/gdata/</a>
        for more information about Google Data <acronym class="acronym">API</acronym>.
    </p>
<p>
        The services that are accessible by <code class="classname">Zend_Gdata</code> include the
        following:

        </p>
<div class="itemizedlist"><ul type="disc">
<li><p>
                    <a href="zend.gdata.calendar.html" title="1.4. Using Google Calendar">Google Calendar</a>
                    is a popular online calendar application.
                </p></li>
<li><p>
                    <a href="zend.gdata.spreadsheets.html" title="1.6. Using Google Spreadsheets">Google Spreadsheets</a>
                    provides an online collaborative spreadsheets tool which
                    can be used as a simple data store for your applications.
                </p></li>
<li><p>
                    <a href="zend.gdata.docs.html" title="1.5. Using Google Documents List Data API">Google Documents List</a>
                    provides an online list of all spreadsheets, word processing documents,
                    and presentations stored in a Google account.
                </p></li>
<li><p>
                    <a href="zend.gdata.gapps.html" title="1.7. Using Google Apps Provisioning">Google Provisioning</a>
                    provides the ability to create, retrieve, update, and
                    delete user accounts, nicknames, and email lists on a
                    Google Apps hosted domain.
                </p></li>
<li><p>
                    <a href="zend.gdata.gbase.html" title="1.8. Using Google Base">Google Base</a>
                    provides the ability to retrieve, post, update, and
                    delete items in Google Base.
                </p></li>
<li><p>
                    <a href="zend.gdata.youtube.html" title="1.10. Using the YouTube Data API">YouTube</a>
                    provides the ability to search and retrieve videos,
                    comments, favorites, subscriptions, user profiles
                    and more.
                </p></li>
<li><p>
                    <a href="zend.gdata.photos.html" title="1.9. Using Picasa Web Albums">Picasa Web Albums</a>
                    provides an online photo sharing application.
                </p></li>
<li><p>
                    <a href="http://code.google.com/apis/blogger/developers_guide_php.html" target="_top">Google Blogger</a>
                    is a popular Internet provider of
                    "push-button publishing" and syndication.
                </p></li>
<li><p>
                    Google CodeSearch
                    allows you to search public source code from many projects.
                </p></li>
<li><p>
                    Google Notebook
                    allows you to view public Notebook content.
                </p></li>
</ul></div>
<p>
    </p>
<div class="note"><table border="0" summary="Note: Unsupported services">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Unsupported services</th>
</tr>
<tr><td align="left" valign="top"><p>
            <code class="classname">Zend_Gdata</code> does not provide an interface to any other Google
            service, such as Search, Gmail, Translation, or Maps.
            Only services that support the Google Data <acronym class="acronym">API</acronym> are supported.
        </p></td></tr>
</table></div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.structure"></a>1.1.1. Structure of Zend_Gdata</h3></div></div></div>
<p>
            <code class="classname">Zend_Gata</code> is composed of several types of classes:
            </p>
<div class="itemizedlist"><ul type="disc">
<li><p>
                        Service classes - inheriting from <code class="classname">Zend_Gdata_App</code>.
                        These also include other classes such as <code class="classname">Zend_Gdata</code>,
                        <code class="classname">Zend_Gdata_Spreadsheets</code>, etc. These classes enable
                        interacting with APP or GData services and provide the
                        ability to retrieve feeds, retrieve entries, post
                        entries, update entries and delete entries.
                    </p></li>
<li><p>
                        Query classes - inheriting from <code class="classname">Zend_Gdata_Query</code>.
                        These also include other classes for specific services,
                        such as <code class="classname">Zend_Gdata_Spreadsheets_ListQuery</code> and
                        <code class="classname">Zend_Gdata_Spreadsheets_CellQuery</code>. Query classes
                        provide methods used to construct a query for data
                        to be retrieved from GData services. Methods include
                        getters and setters like <code class="methodname">setUpdatedMin()</code>,
                        <code class="methodname">setStartIndex()</code>, and
                        <code class="methodname">getPublishedMin()</code>. The query classes also
                        have a method to generate a <acronym class="acronym">URL</acronym> representing the
                        constructed query -- <code class="code">getQueryUrl</code>.
                        Alternatively, the query string component of the <acronym class="acronym">URL</acronym>
                        can be retrieved used the <code class="methodname">getQueryString()</code>
                        method.
                    </p></li>
<li><p>
                        Feed classes - inheriting from <code class="classname">Zend_Gdata_App_Feed</code>.
                        These also include other classes such as
                        <code class="classname">Zend_Gdata_Feed</code>,
                        <code class="classname">Zend_Gdata_Spreadsheets_SpreadsheetFeed</code>,
                        and <code class="classname">Zend_Gdata_Spreadsheets_ListFeed</code>.
                        These classes represent feeds of entries retrieved
                        from services. They are primarily used to retrieve
                        data returned from services.
                    </p></li>
<li><p>
                        Entry classes - inheriting from <code class="classname">Zend_Gdata_App_Entry</code>.
                        These also include other classes such as
                        <code class="classname">Zend_Gdata_Entry</code>, and <code class="classname">Zend_Gdata_Spreadsheets_ListEntry</code>.
                        These classes represent entries retrieved from
                        services or used for constructing data to send to
                        services. In addition to being able to set the
                        properties of an entry (such as the spreadsheet cell
                        value), you can use an entry object to send update
                        or delete requests to a service. For example,
                        you can call <code class="code">$entry-&gt;save()</code> to save
                        changes made to an entry back to service from which
                        the entry initiated, or <code class="code">$entry-&gt;delete()</code>
                        to delete an entry from the server.
                    </p></li>
<li><p>
                        Other Data model classes - inheriting from
                        <code class="classname">Zend_Gdata_App_Extension</code>. These include classes such
                        as <code class="classname">Zend_Gdata_App_Extension_Title</code> (representing the
                        atom:title <acronym class="acronym">XML</acronym> element), <code class="classname">Zend_Gdata_Extension_When</code>
                        (representing the gd:when <acronym class="acronym">XML</acronym> element used by the
                        GData Event "Kind"), and
                        <code class="classname">Zend_Gdata_Extension_Cell</code> (representing the gs:cell
                        <acronym class="acronym">XML</acronym> element used by Google Spreadsheets). These
                        classes are used purely to store the data retrieved
                        back from services and for constructing data to be
                        sent to services. These include getters and setters
                        such as
                        <code class="methodname">setText()</code> to set the child text
                        node of an element, <code class="methodname">getText()</code> to retrieve
                        the text node of an element, <code class="methodname">getStartTime()</code>
                        to retrieve the start time attribute of a When element,
                        and other similiar methods.
                        The data model classes also include methods such as
                        <code class="methodname">getDOM()</code> to retrieve a DOM representation
                        of the element and all children and
                        <code class="methodname">transferFromDOM()</code> to construct a data
                        model representation of a DOM tree.
                    </p></li>
</ul></div>
<p>
        </p>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.services"></a>1.1.2. Interacting with Google Services</h3></div></div></div>
<p>
            Google data services are based upon the Atom Publishing Protocol
            (APP) and the Atom syndication format. To interact with APP or
            Google services using the <code class="classname">Zend_Gdata</code> component, you need to use
            the service classes such as <code class="classname">Zend_Gdata_App</code>, <code class="classname">Zend_Gdata</code>,
            <code class="classname">Zend_Gdata_Spreadsheets</code>, etc. These service classes provide
            methods to retrieve data from services as feeds, insert new
            entries into feeds, update entries, and delete entries.
        </p>
<p>
            Note: A full example of working with <code class="classname">Zend_Gdata</code> is available in the
            <code class="code">demos/Zend/Gdata</code> directory. This example is runnable
            from the command-line, but the methods contained within are easily
            portable to a web application.
        </p>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.magicfactory"></a>1.1.3. Obtaining instances of Zend_Gdata classes</h3></div></div></div>
<p>
            The Zend Framework naming standards require that all classes be
            named based upon the directory structure in which they are located.
            For instance, extensions related to Spreadsheets are stored in:
            <code class="code">Zend/Gdata/Spreadsheets/Extension/...</code> and, as a result
            of this, are named
            <code class="classname">Zend_Gdata_Spreadsheets_Extension_...</code>.
            This causes a lot of typing if you're trying to construct a new
            instance of a spreadsheet cell element!
        </p>
<p>
            We've implemented a magic factory method in all service classes
            (such as <code class="classname">Zend_Gdata_App</code>, <code class="classname">Zend_Gdata</code>, <code class="classname">Zend_Gdata_Spreadsheets</code>) that
            should make constructing new instances of data model, query and
            other classes much easier. This magic factory is implemented by
            using the magic <code class="code">__call</code> method to intercept all attempts
            to call <code class="code">$service-&gt;newXXX(arg1, arg2, ...)</code>. Based off
            the value of XXX, a search is performed in all registered 'packages'
            for the desired class. Here's some examples:
        </p>
<pre class="programlisting">
$ss = new Zend_Gdata_Spreadsheets();

// creates a Zend_Gdata_App_Spreadsheets_CellEntry
$entry = $ss-&gt;newCellEntry();

// creates a Zend_Gdata_App_Spreadsheets_Extension_Cell
$cell = $ss-&gt;newCell();
$cell-&gt;setText('My cell value');
$cell-&gt;setRow('1');
$cell-&gt;setColumn('3');
$entry-&gt;cell = $cell;

// ... $entry can then be used to send an update to a Google Spreadsheet
</pre>
<p>
            Each service class in the inheritance tree is responsible for
            registering the appropriate 'packages' (directories) which are to
            be searched when calling the magic factory method.
        </p>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.authentication"></a>1.1.4. Google Data Client Authentication</h3></div></div></div>
<p>
            Most Google Data services require client applications to
            authenticate against the Google server before accessing
            private data, or saving or deleting data.
            There are two implementations of authentication for Google Data:
            <a href="zend.gdata.authsub.html" title="1.2. Authenticating with AuthSub">AuthSub</a> and
            <a href="zend.gdata.clientlogin.html" title="1.3. Authenticating with ClientLogin">ClientLogin</a>.
            <code class="classname">Zend_Gdata</code> offers class interfaces for both of these methods.
        </p>
<p>
            Most other types of queries against Google Data services do not
            require authentication.
        </p>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.dependencies"></a>1.1.5. Dependencies</h3></div></div></div>
<p>
            <code class="classname">Zend_Gdata</code> makes use of
            <a href="">Zend_Http_Client</a> to send
            requests to google.com and fetch results. The response to most
            Google Data requests is returned as a subclass of the
            <code class="classname">Zend_Gdata_App_Feed</code> or <code class="classname">Zend_Gdata_App_Entry</code> classes.
        </p>
<p>
            <code class="classname">Zend_Gdata</code> assumes your <acronym class="acronym">PHP</acronym> application is running on a host that
            has a direct connection to the Internet.
            The <code class="classname">Zend_Gdata</code> client operates by contacting Google Data servers.
        </p>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.creation"></a>1.1.6. Creating a new Gdata client</h3></div></div></div>
<p>
            Create a new object of class <code class="classname">Zend_Gdata_App</code>, <code class="classname">Zend_Gdata</code>, or one
            of the subclasses available that offer helper methods for
            service-specific behavior.
        </p>
<p>
            The single optional parameter to the <code class="classname">Zend_Gdata_App</code> constructor
            is an instance of
            <a href="">Zend_Http_Client</a>.
            If you don't pass this parameter, <code class="classname">Zend_Gdata</code> creates a default
            <code class="classname">Zend_Http_Client</code> object, which will not have associated
            credentials to access private feeds. Specifying the
            <code class="classname">Zend_Http_Client</code> object also allows you to
            pass configuration options to that client object.
        </p>
<pre class="programlisting">
$client = new Zend_Http_Client();
$client-&gt;setConfig( ...options... );

$gdata = new Zend_Gdata($client);
</pre>
<p>
            Beginning with Zend Framework 1.7, support has been added for
            protocol versioning. This allows the client and server to support
            new features while maintaining backwards compatibility. While most
            services will manage this for you, if you create a <code class="classname">Zend_Gdata</code>
            instance directly (as opposed to one of its subclasses), you may
            need to specify the desired protocol version to access certain
            server functionality.
        </p>
<pre class="programlisting">
$client = new Zend_Http_Client();
$client-&gt;setConfig( ...options... );

$gdata = new Zend_Gdata($client);
$gdata-&gt;setMajorProtocolVersion(2);
$gdata-&gt;setMinorProtocolVersion(null);
</pre>
<p>
            Also see the sections on authentication for methods to
            create an authenticated <code class="classname">Zend_Http_Client</code> object.
        </p>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.parameters"></a>1.1.7. Common Query Parameters</h3></div></div></div>
<p>
            You can specify parameters to customize queries with <code class="classname">Zend_Gdata</code>.
            Query parameters are specified using subclasses of <code class="classname">Zend_Gdata_Query</code>.
            The <code class="classname">Zend_Gdata_Query</code> class includes methods to set all query
            parameters used throughout GData services. Individual services,
            such as Spreadsheets, also provide query classes to defined
            parameters which are custom to the particular service and feeds.
            Spreadsheets includes a CellQuery class to query the Cell Feed
            and a ListQuery class to query the List Feed, as different
            query parameters are applicable to each of those feed types.

            The GData-wide parameters are described below.
        </p>
<div class="itemizedlist"><ul type="disc">
<li>
<p>
                    The <code class="code">q</code> parameter specifies a full-text
                    query. The value of the parameter is a string.
                </p>
<p>
                    Set this parameter with the <code class="methodname">setQuery()</code>
                    function.
                </p>
</li>
<li>
<p>
                    The <code class="code">alt</code> parameter specifies the feed type.
                    The value of the parameter can be
                    <code class="code">atom</code>,
                    <code class="code">rss</code>,
                    <code class="code">json</code>,
                    or <code class="code">json-in-script</code>.
                    If you don't specify this parameter, the default feed type
                    is <code class="code">atom</code>. NOTE: Only the output of the
                    atom feed format can be processed using
                    <code class="classname">Zend_Gdata</code>.
                    The <code class="classname">Zend_Http_Client</code> could be used to retrieve
                    feeds in other formats, using query <acronym class="acronym">URL</acronym>s generated by the
                    <code class="classname">Zend_Gdata_Query</code> class and its subclasses.
                </p>
<p>
                    Set this parameter with the <code class="methodname">setAlt()</code>
                    function.
                </p>
</li>
<li>
<p>
                    The <code class="code">maxResults</code> parameter limits the number
                    of entries in the feed. The value of the parameter is
                    an integer. The number of entries returned in the feed
                    will not exceed this value.
                </p>
<p>
                    Set this parameter with the <code class="methodname">setMaxResults()</code>
                    function.
                </p>
</li>
<li>
<p>
                    The <code class="code">startIndex</code> parameter specifies the
                    ordinal number of the first entry returned in the feed.
                    Entries before this number are skipped.
                </p>
<p>
                    Set this parameter with the <code class="methodname">setStartIndex()</code>
                    function.
                </p>
</li>
<li>
<p>
                    The <code class="code">updatedMin</code> and <code class="code">updatedMax</code>
                    parameters specify bounds on the entry date.
                    If you specify a value for <code class="code">updatedMin</code>,
                    no entries that were updated earlier than the date
                    you specify are included in the feed. Likewise
                    no entries updated after the date specified by
                    <code class="code">updatedMax</code> are included.
                </p>
<p>
                    You can use numeric timestamps, or a variety of
                    date/time string representations as the value for
                    these parameters.
                </p>
<p>
                    Set this parameter with the <code class="methodname">setUpdatedMin()</code>
                    and <code class="methodname">setUpdatedMax()</code> functions.
                </p>
</li>
</ul></div>
<p>
            There is a <code class="code">get</code> function for each
            <code class="code">set</code> function.
        </p>
<pre class="programlisting">
$query = new Zend_Gdata_Query();
$query-&gt;setMaxResults(10);
echo $query-&gt;getMaxResults();   // returns 10
</pre>
<p>
            The <code class="classname">Zend_Gdata</code> class also implements "magic" getter and
            setter methods, so you can use the name of the parameter
            as a virtual member of the class.
        </p>
<pre class="programlisting">
$query = new Zend_Gdata_Query();
$query-&gt;maxResults = 10;
echo $query-&gt;maxResults;        // returns 10
</pre>
<p>
            You can clear all parameters with the <code class="methodname">resetParameters()</code>
            function. This is useful to do if you reuse a <code class="classname">Zend_Gdata</code>
            object for multiple queries.
        </p>
<pre class="programlisting">
$query = new Zend_Gdata_Query();
$query-&gt;maxResults = 10;
// ...get feed...

$query-&gt;resetParameters();      // clears all parameters
// ...get a different feed...
</pre>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.getfeed"></a>1.1.8. Fetching a Feed</h3></div></div></div>
<p>
            Use the <code class="methodname">getFeed()</code> function to retrieve
            a feed from a specified <acronym class="acronym">URI</acronym>.
            This function returns an instance of class specified
            as the second argument to getFeed, which defaults to
            <code class="classname">Zend_Gdata_Feed</code>.
        </p>
<pre class="programlisting">
$gdata = new Zend_Gdata();
$query = new Zend_Gdata_Query(
        'http://www.blogger.com/feeds/blogID/posts/default');
$query-&gt;setMaxResults(10);
$feed = $gdata-&gt;getFeed($query);
</pre>
<p>
            See later sections for special functions in each
            helper class for Google Data services. These
            functions help you to get feeds from the <acronym class="acronym">URI</acronym> that is
            appropriate for the respective service.
        </p>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.paging"></a>1.1.9. Working with Multi-page Feeds</h3></div></div></div>
<p>
            When retrieving a feed that contains a large number of entries,
            the feed may be broken up into many smaller "pages" of feeds. When
            this occurs, each page will contain a link to the next page in the
            series. This link can be accessed by calling
            <code class="methodname">getLink('next')</code>. The following example shows how to
            retrieve the next page of a feed:
        </p>
<pre class="programlisting">
function getNextPage($feed) {
    $nextURL = $feed-&gt;getLink('next');
    if ($nextURL !== null) {
        return $gdata-&gt;getFeed($nextURL);
    } else {
        return null;
    }
}
</pre>
<p>
            If you would prefer not to work with pages in your application,
            pass the first page of the feed into
            <code class="methodname">Zend_Gdata_App::retrieveAllEntriesForFeed()</code>, which
            will consolidate all entries from each page into a single feed.
            This example shows how to use this function:
        </p>
<pre class="programlisting">
$gdata = new Zend_Gdata();
$query = new Zend_Gdata_Query(
        'http://www.blogger.com/feeds/blogID/posts/default');
$feed = $gdata-&gt;retrieveAllEntriesForFeed($gdata-&gt;getFeed($query));
</pre>
<p>
            Keep in mind when calling this function that it may take a long
            time to complete on large feeds. You may need to increase <acronym class="acronym">PHP</acronym>'s
            execution time limit by calling <code class="methodname">set_time_limit()</code>.
        </p>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.usefeedentry"></a>1.1.10. Working with Data in Feeds and Entries</h3></div></div></div>
<p>
            After retrieving a feed, you can read the data from the feed
            or the entries contained in the feed using either the accessors
            defined in each of the data model classes or the magic
            accessors. Here's an example:
        </p>
<pre class="programlisting">
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$gdata = new Zend_Gdata($client);
$query = new Zend_Gdata_Query(
        'http://www.blogger.com/feeds/blogID/posts/default');
$query-&gt;setMaxResults(10);
$feed = $gdata-&gt;getFeed($query);
foreach ($feed as $entry) {
    // using the magic accessor
    echo 'Title: ' . $entry-&gt;title-&gt;text;
    // using the defined accessors
    echo 'Content: ' . $entry-&gt;getContent()-&gt;getText();
}
</pre>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.updateentry"></a>1.1.11. Updating Entries</h3></div></div></div>
<p>
            After retrieving an entry, you can update that entry and save
            changes back to the server. Here's an example:
        </p>
<pre class="programlisting">
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$gdata = new Zend_Gdata($client);
$query = new Zend_Gdata_Query(
        'http://www.blogger.com/feeds/blogID/posts/default');
$query-&gt;setMaxResults(10);
$feed = $gdata-&gt;getFeed($query);
foreach ($feed as $entry) {
    // update the title to append 'NEW'
    echo 'Old Title: ' . $entry-&gt;title-&gt;text;
    $entry-&gt;title-&gt;text = $entry-&gt;title-&gt;text . ' NEW';

    // update the entry on the server
    $newEntry = $entry-&gt;save();
    echo 'New Title: ' . $newEntry-&gt;title-&gt;text;
}
</pre>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.post"></a>1.1.12. Posting Entries to Google Servers</h3></div></div></div>
<p>
            The <code class="classname">Zend_Gdata</code> object has a function
            <code class="methodname">insertEntry()</code> with which you can upload data to save
            new entries to Google Data services.
        </p>
<p>
            You can use the data model classes for each service to construct
            the appropriate entry to post to Google's services. The
            <code class="methodname">insertEntry()</code> function will accept a child of
            <code class="classname">Zend_Gdata_App_Entry</code> as data to post to the service.
            The method returns a child of <code class="classname">Zend_Gdata_App_Entry</code>
            which represents the state of the entry as it was returned from
            the server.
        </p>
<p>
            Alternatively, you could construct the <acronym class="acronym">XML</acronym> structure for an entry
            as a string and pass the string to the <code class="methodname">insertEntry()</code>
            function.
        </p>
<pre class="programlisting">
$gdata = new Zend_Gdata($authenticatedHttpClient);

$entry = $gdata-&gt;newEntry();
$entry-&gt;title = $gdata-&gt;newTitle('Playing football at the park');
$content =
    $gdata-&gt;newContent('We will visit the park and play football');
$content-&gt;setType('text');
$entry-&gt;content = $content;

$entryResult = $gdata-&gt;insertEntry($entry,
        'http://www.blogger.com/feeds/blogID/posts/default');

echo 'The &lt;id&gt; of the resulting entry is: ' . $entryResult-&gt;id-&gt;text;
</pre>
<p>
            To post entries, you must be using an authenticated
            <code class="classname">Zend_Http_Client</code> that you created using the <code class="classname">Zend_Gdata_AuthSub</code>
            or <code class="classname">Zend_Gdata_ClientLogin</code> classes.
        </p>
</div>
<div class="sect2" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="zend.gdata.introduction.delete"></a>1.1.13. Deleting Entries on Google Servers</h3></div></div></div>
<p>
            Option 1: The <code class="classname">Zend_Gdata</code> object has a function <code class="methodname">delete()</code>
            with which you can delete entries from Google Data
            services. Pass the edit <acronym class="acronym">URL</acronym> value from
            a feed entry to the <code class="methodname">delete()</code> method.
        </p>
<p>
            Option 2: Alternatively, you can call <code class="code">$entry-&gt;delete()</code>
            on an entry retrieved from a Google service.
        </p>
<pre class="programlisting">
$gdata = new Zend_Gdata($authenticatedHttpClient);
// a Google Data feed
$feedUri = ...;
$feed = $gdata-&gt;getFeed($feedUri);
foreach ($feed as $feedEntry) {
    // Option 1 - delete the entry directly
    $feedEntry-&gt;delete();
    // Option 2 - delete the entry by passing the edit URL to
    // $gdata-&gt;delete()
    // $gdata-&gt;delete($feedEntry-&gt;getEditLink()-&gt;href);
}
</pre>
<p>
            To delete entries, you must be using an authenticated
            <code class="classname">Zend_Http_Client</code> that you created using the <code class="classname">Zend_Gdata_AuthSub</code>
            or <code class="classname">Zend_Gdata_ClientLogin</code> classes.
        </p>
</div>
</div>
<font color="red">&lt;xi:include&gt;&lt;/xi:include&gt;</font><font color="red">&lt;xi:include&gt;&lt;/xi:include&gt;</font>
</div>
<div class="navfooter"><table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="index.html">Prev</a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="zend.gdata.authsub.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Programmer's Reference Guide </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> 1.2. Authenticating with AuthSub</td>
</tr>
</table></div>
<div class="revinfo"></div>
</body>
</html>
